package sitescoring.controller;

import java.io.IOException;
import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import sitescoring.data.QnAPersistenceManager;
import sitescoring.model.Domain;


@SuppressWarnings("serial")
public class SitescoringServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/plain");
		resp.getWriter().println("Hello, world");
		String name = "re.abc.com";
		PersistenceManager psm = QnAPersistenceManager.get().getPersistenceManager();
		
//		Query query = psm.newQuery(Domain.class);
//		@SuppressWarnings("unchecked")
//		List<Domain> domains = (List<Domain>)query.execute();
		req.setAttribute("name", name);
//		if(domains.size()>0)
//		{
//			req.setAttribute("domains", domains.get(0));
//		}
		try {
			req.getRequestDispatcher("/index.jsp").forward(req, resp);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
